{
  "displayName":    "JavaScript",
  "name":           "javascript",
  "mimeTypes":      ["text/javascript","application/json"],
  "fileExtensions": ["js","json"],
  
  "lineComment":      "//",   
  "blockCommentStart": "/*",
  "blockCommentEnd":   "*/",

  "workerScriptPath": "vs/languages/javascript/javascript-worker",
  "tokenPostfix":     ".js",

  "keywords": [
    "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", 
    "default", "delete", "do", "double", "else", "enum", "extends", "false", "final", 
    "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", 
    "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", 
    "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", 
    "throw", "throws", "transient", "true", "try", "typeof", "var", "void", "volatile", "while", 
    "with"
  ],

  "extraKeywords": [
  ],
  
  "builtins": [
    "define","require","window","document","undefined"
  ],

  "extraBuiltins": [
  ],

  "operators": [
    "=", ">", "<", "!", "~", "?", ":", 
    "==", "<=", ">=", "!=", "&&", "||", "++", "--", 
    "+", "-", "*", "/", "&", "|", "^", "%", "<<", 
    ">>", ">>>", "+=", "-=", "*=", "/=", "&=", "|=", 
    "^=", "%=", "<<=", ">>=", ">>>="    
  ],
  
  "extraOperators": [
  ],
  
  "brackets": [
    ["(",")","bracket.parenthesis"],
    ["{","}","bracket.curly"],
    ["[","]","bracket.square"]
  ],
  
  "autoClosingPairs": [
    ["\"","\""],["'","'"],["/","/"],["@brackets"]
  ],

  
  "symbols":  "[~!@#%\\^&*-+=|\\\\:`<>.?\\/]+",
  "escapes":  "\\\\(?:[btnfr\\\\\"']|[0-7][0-7]?|[0-3][0-7]{2})",
  "exponent": "[eE][\\-+]?[0-9]+",
  
  "regexpctl": "[(){}\\[\\]\\$\\^|\\-*+?\\.]",
  "regexpesc": "\\\\(?:[bBdDfnrstvwWn0\\\\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})",
    
  "tokenizer": {
    "root": [
      
      ["([a-zA-Z_\\$][\\w\\$]*)(\\s*)(:?)", { 
        "cases": { "$1@keywords": ["keyword","white","delimiter"],
                 "$1@extraKeywords": ["keyword","white","delimiter"],
                 "$3": ["key.identifier","white","delimiter"],   
                 "$1@builtins": ["predefined.identifier","white","delimiter"],
                 "$1@extraBuiltins": ["predefined.identifier","white","delimiter"],
                 "@default": ["identifier","white","delimiter"] } }],
      
      
      { "include": "@whitespace" },
      
      
      ["\\/(?=([^\\\\\\/]|\\\\.)+\\/)", { "token": "regexp.slash", "bracket": "@open", "next": "@regexp"}], 
      
      
      ["[{}()\\[\\]]", "@brackets"],
      ["[;,.]", "delimiter"],
      ["@symbols", { "cases": {"@operators": "operator",
                             "@extraOperators": "operator",
                             "@default": "" }}],

      
      ["\\d+\\.\\d*(@exponent)?", "number.float"],
      ["\\.\\d+(@exponent)?", "number.float"],
      ["\\d+@exponent", "number.float"],
      ["0[xX][\\da-fA-F]+", "number.hex"],
      ["0[0-7]+", "number.octal"],
      ["\\d+", "number"],

      
      ["\"([^\"\\\\]|\\\\.)*$", "string.invalid" ],  
      ["'([^'\\\\]|\\\\.)*$", "string.invalid" ],  
      ["\"",  "string", "@string.\"" ],
      ["'",  "string", "@string.'" ]
    ],

    "whitespace": [
      ["[ \\t\\r\\n]+", "white"],
      ["\\/\\*",       "comment", "@comment" ],
      ["\\/\\/.*$",    "comment"]
    ],

    "comment": [
      ["[^\\/*]+", "comment" ],
      
      ["\\/\\*",    "comment.invalid" ],
      ["\\*/",    "comment", "@pop"  ],
      ["[\\/*]",   "comment" ]
    ],  

    "string": [
      ["[^\\\\\"']+", "string"],
      ["@escapes", "string.escape"],
      ["\\\\.",      "string.escape.invalid"],
      ["[\"']",     { "cases": { "$#==$S2" : { "token": "string", "next": "@pop" },
                              "@default": "string" }} ]
    ],
    
    
    "regexp": [
      ["(\\{)(\\d+(?:,\\d*)?)(\\})", ["@brackets.regexp.escape.control", "regexp.escape.control", "@brackets.regexp.escape.control"] ],
      ["(\\[)(\\^?)(?=(?:[^\\]\\\\\\/]|\\\\.)+)", ["@brackets.regexp.escape.control",{ "token": "regexp.escape.control", "next": "@regexrange"}]],
      ["(\\()(\\?:|\\?=|\\?!)", ["@brackets.regexp.escape.control","regexp.escape.control"] ],
      ["[()]",        "@brackets.regexp.escape.control"],
      ["@regexpctl",  "regexp.escape.control"],
      ["[^\\\\\\/]",     "regexp" ],
      ["@regexpesc",  "regexp.escape" ],      
      ["\\\\\\.",        "regexp.invalid" ],
      ["/",           { "token": "regexp.slash", "bracket": "@close"}, "@pop" ]
    ],
    
    "regexrange": [
      ["-",     "regexp.escape.control"],
      ["\\^",    "regexp.invalid"],
      ["@regexpesc", "regexp.escape"],
      ["[^\\]]", "regexp"],
      ["\\]",    "@brackets.regexp.escape.control", "@pop"]
    ]
  }
}